package com.lzy.huijinjiazu.mvp.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;

import com.gyf.barlibrary.ImmersionBar;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.widget.autolayout.AutoToolbar;
import com.lzy.huijinjiazu.R;
import com.lzy.huijinjiazu.di.component.DaggerProfitDetailedComponent;
import com.lzy.huijinjiazu.di.module.ProfitDetailedModule;
import com.lzy.huijinjiazu.mvp.contract.ProfitDetailedContract;
import com.lzy.huijinjiazu.mvp.presenter.ProfitDetailedPresenter;
import com.lzy.huijinjiazu.mvp.ui.adapter.ProfitDetailedAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

import static com.jess.arms.utils.Preconditions.checkNotNull;


public class ProfitDetailedActivity extends BaseActivity<ProfitDetailedPresenter> implements ProfitDetailedContract.View {


    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.rv_list)
    RecyclerView mRvList;
    @BindView(R.id.refreshLayout)
    SmartRefreshLayout mRefreshLayout;
    private ProfitDetailedAdapter mAdapter;

    @Override
    public void setupActivityComponent(AppComponent appComponent) {
        DaggerProfitDetailedComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .profitDetailedModule(new ProfitDetailedModule(this))
                .build()
                .inject(this);
    }

    @Override
    public int initView(Bundle savedInstanceState) {
        return R.layout.activity_profit_detailed; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        mToolbar.getBackground().setAlpha(0);
        initRecyclerView();
        initData();
    }

    private void initRecyclerView() {
        ArmsUtils.configRecyclerView(mRvList, new LinearLayoutManager(this));
        mAdapter = new ProfitDetailedAdapter();
        mRvList.setAdapter(mAdapter);
    }

    private void initData() {
        List<String> data = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            data.add("");
        }
        mAdapter.setNewData(data);
    }

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();
        mImmersionBar.setTitleBarMarginTop(this, mToolbar);
    }

}
